<?php
header('content-Type：application/json');
include './connDB.php';

$query = "SELECT content FROM gasdata order by id desc"; 
$result = $conn->query($query);

$gasdata = array();
foreach ($result->fetchAll(PDO::FETCH_ASSOC) as $row) {     
    $gasdata[] = $row;
}

if (($count = count($gasdata)) > 0) {
  $return= array('count' => $count);
  $return['data'] = $gasdata;
  echo json_encode($return);
} else {
  echo json_encode(array('count' => 0));
}
?>

